<%@ page import="com.mastercard.labs.Voucher" %>



<div class="fieldcontain ${hasErrors(bean: voucherInstance, field: 'categories', 'error')} ">
	<label for="categories">
		<g:message code="voucher.categories.label" default="Categories" />
		
	</label>
	<g:select name="categories" from="${com.mastercard.labs.Category.list()}" multiple="multiple" optionKey="id" size="5" value="${voucherInstance?.categories*.id}" class="many-to-many"/>
</div>

<div class="fieldcontain ${hasErrors(bean: voucherInstance, field: 'description', 'error')} ">
	<label for="description">
		<g:message code="voucher.description.label" default="Description" />
		
	</label>
	<g:textField name="description" value="${voucherInstance?.description}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: voucherInstance, field: 'endDate', 'error')} required">
	<label for="endDate">
		<g:message code="voucher.endDate.label" default="End Date" />
		<span class="required-indicator">*</span>
	</label>
	<g:datePicker name="endDate" precision="day"  value="${voucherInstance?.endDate}"  />
</div>

<div class="fieldcontain ${hasErrors(bean: voucherInstance, field: 'imageUrl', 'error')} ">
	<label for="imageUrl">
		<g:message code="voucher.imageUrl.label" default="Image Url" />
		
	</label>
	<g:textField name="imageUrl" value="${voucherInstance?.imageUrl}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: voucherInstance, field: 'merchant', 'error')} required">
	<label for="merchant">
		<g:message code="voucher.merchant.label" default="Merchant" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="merchant" name="merchant.id" from="${com.mastercard.labs.Merchant.list()}" optionKey="id" required="" value="${voucherInstance?.merchant?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: voucherInstance, field: 'price', 'error')} required">
	<label for="price">
		<g:message code="voucher.price.label" default="Price" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="number" name="price" required="" value="${fieldValue(bean: voucherInstance, field: 'price')}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: voucherInstance, field: 'startDate', 'error')} required">
	<label for="startDate">
		<g:message code="voucher.startDate.label" default="Start Date" />
		<span class="required-indicator">*</span>
	</label>
	<g:datePicker name="startDate" precision="day"  value="${voucherInstance?.startDate}"  />
</div>

<div class="fieldcontain ${hasErrors(bean: voucherInstance, field: 'title', 'error')} ">
	<label for="title">
		<g:message code="voucher.title.label" default="Title" />
		
	</label>
	<g:textField name="title" value="${voucherInstance?.title}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: voucherInstance, field: 'totalQuantity', 'error')} required">
	<label for="totalQuantity">
		<g:message code="voucher.totalQuantity.label" default="Total Quantity" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="number" name="totalQuantity" required="" value="${fieldValue(bean: voucherInstance, field: 'totalQuantity')}"/>
</div>

